package com.un.ebs.product.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.un.ebs.product.domain.ProductSkuItem;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Component;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author liubo
 * @since 2020-02-23
 */
@Component
public interface ProductSkuItemMapper extends BaseMapper<ProductSkuItem> {

    @Select("select isnull(max(sort)+1,1) from tb_product_sku_item")
    int maxSort();

    @Select("select isnull(max(sort)+1,1) from tb_product_sku_item where parent_id=#{parentId}")
    int maxSortByParentId(@Param("parentId") String parentId);

    @Select("select top 1 * from tb_product_sku_item where sku_id=#{skuId} and include_sku_id=#{includeSkuId}")
    ProductSkuItem selectBy(@Param("skuId") String skuId,@Param("includeSkuId") String includeSkuId);

}
